﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Data;

namespace GPCSC.Web.CM
{
    public partial class ncs : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                F_bound();
            }
        }
        protected void F_bound()
        {
            string ids = Usual.f_querystringToString("ids");
            Hashtable htable = new Hashtable();
            htable.Add("@id",ids);
            DataSet ds = new SqlReadXml().ReaderDataSet("sel_NongCun_bykid",htable);
            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    UIFactory.UIFactory_Set(this, ds.Tables[0]);
                    sdf.Value = ds.Tables[0].Rows[0]["NC_XFJDQK_JDXFAJ"].ToString().Trim();
                }
            }
        }

        //提交
        protected void Button3_Click(object sender, EventArgs e)
        {
            double zcru = Usual.f_convertDobule(MTXTD_NC_ZFDY_ZCRHTS.Value);
            double zdzh = Usual.f_convertDobule(MTXTD_NC_ZFDY_ZDZHTS.Value);
            double ZDAY = Usual.f_convertDobule(MtxtD_zday.Value);
            if (zcru > ZDAY && zdzh > ZDAY)
            {
                Response.Write("<script>alert('走村入户与驻点住户天数均不得大于活动天数')</script>");
                return;
            }
            else if (zcru > ZDAY && zdzh <= ZDAY)
            {
                Response.Write("<script>alert('走村入户天数不得大于活动天数')</script>");
                return;
            }
            else if (zcru <= ZDAY && zdzh > ZDAY)
            {
                Response.Write("<script>alert('驻点住户天数不得大于活动天数')</script>");
                return;
            }
            else
            {
                string ids = Usual.f_querystringToString("ids");
                Hashtable hta = f_getElements();
                hta.Add("NC_XFJDQK_JDXFAJ", sdf.Value.Trim());
                //hta.Add("IsBs",0);
                SQLServerDAL.databyhtable dtable = new SQLServerDAL.databyhtable();
                dtable.databyhtables(hta, "update", "NongCun", "NCID", ids);
                Response.Write("<script>alert('更新成功');</script>");
            }
           

        }
        //下载
        protected void Button4_Click(object sender, EventArgs e)
        {

        }
        public Hashtable f_getElements()
        {

            base.o_uiTable.Clear();
            base.o_uiTable = UIFactory.UIFactory_Get(this);
            return base.o_uiTable;
        }
    }
}